import rewardApi from "@/api/declaration/mall/rewardApi"
import httpRequest from "@/config/axios/httpRequest"
import { RewardActivityModel } from "@/models/mall/RewardRuleModel"


// 新增满减送活动
export const createRewardActivity = async (data: RewardActivityModel) => {
  return await httpRequest.post(rewardApi.CreateRewardActivity, data)
}

// 更新满减送活动
export const updateRewardActivity = async (data: RewardActivityModel) => {
  return await httpRequest.put(rewardApi.UpdateRewardActivity, data)
}

// 查询满减送活动列表
export const getRewardActivityPage = async (params) => {
  return await httpRequest.get(rewardApi.GetRewardActivityPage, { params })
}

// 查询满减送活动详情
export const getReward = async (id: number) => {
  return await httpRequest.get(rewardApi.GetReward, { params: { id } })
}

// 删除满减送活动
export const deleteRewardActivity = async (id: number) => {
  return await httpRequest.delete(rewardApi.DeleteRewardActivity, { params: { id } })
}

// 关闭满减送活动
export const closeRewardActivity = async (id: number) => {
  return await httpRequest.put(rewardApi.CloseRewardActivity, { id })
}
